/* $Id: javascript.js,v 1.2 2006/05/02 18:02:09 diegor Exp $ */

function refresh_date () {
  now = new Date();
  document.getElementById("datetime").innerHTML = now.toLocaleString();
}

function addIt(selectList, pickList) {
  var selectIndex = selectList.selectedIndex;
  var selectOptions = selectList.options;
  var pickOptions = pickList.options;
  var pickOLength = pickOptions.length;
  if (selectIndex > -1) {
    pickOptions[pickOLength] = new Option(selectList[selectIndex].text);
    pickOptions[pickOLength].value = selectList[selectIndex].value;
    selectOptions[selectIndex] = null;
    var tempText;
    var tempValue;
    while (pickOLength > 0 && pickOptions[pickOLength].text < pickOptions[pickOLength-1].text) {
      tempText = pickOptions[pickOLength-1].text;
      tempValue = pickOptions[pickOLength-1].value;
      pickOptions[pickOLength-1].text = pickOptions[pickOLength].text;
      pickOptions[pickOLength-1].value = pickOptions[pickOLength].value;
      pickOptions[pickOLength].text = tempText;
      pickOptions[pickOLength].value = tempValue;
      pickOLength = pickOLength - 1;
    }
  }
}

function delIt(selectList, pickList) {
  var selectOptions = selectList.options;
  var selectOLength = selectOptions.length;
  var pickIndex = pickList.selectedIndex;
  var pickOptions = pickList.options;
  if (pickIndex > -1) {
    selectOptions[selectOLength] = new Option(pickList[pickIndex].text);
    selectOptions[selectOLength].value = pickList[pickIndex].value;
    pickOptions[pickIndex] = null;
    var tempText;
    var tempValue;
    while (selectOLength > 0 && selectOptions[selectOLength].text < selectOptions[selectOLength-1].text) {
      tempText = selectOptions[selectOLength-1].text;
      tempValue = selectOptions[selectOLength-1].value;
      selectOptions[selectOLength-1].text = selectOptions[selectOLength].text;
      selectOptions[selectOLength-1].value = selectOptions[selectOLength].value;
      selectOptions[selectOLength].text = tempText;
      selectOptions[selectOLength].value = tempValue;
      selectOLength = selectOLength - 1;
    }
  }
}

function getIt(list)
{
  var pickList = list;
  var s = '';
  for (var i = 0; i < pickList.length; i++) {
    if (s != '') {
      s += ',';
    }
    s += pickList[i].value;
  }
  return s;
}
